<template>
  <div class="box">
    <el-breadcrumb separator="/">
      <el-breadcrumb-item :to="{ path: '/page' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>订单管理</el-breadcrumb-item>
      <el-breadcrumb-item>订单列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-card class="box-card">
      <el-input
        style="width: 30%"
        placeholder="请输入内容"
        v-model="keyword"
        class="input-with-select"
      >
        <el-button
          slot="append"
          icon="el-icon-search"
          @click="getlist()"
        ></el-button>
      </el-input>
      <el-table :data="tableData" border style="width: 100%">
        <el-table-column type="index" label="#" width="80"> </el-table-column>
        <el-table-column prop="order_number" label="订单编号" width="720">
        </el-table-column>
        <el-table-column prop="order_price" label="订单价格"> </el-table-column>
        <el-table-column prop="pay_status" label="是否付款">
          <template slot-scope="scope">
            <el-tag type="success" v-if="scope.row.pay_status == 1"
              >已付款</el-tag
            >
            <el-tag type="danger" v-else>未付款</el-tag>
          </template>
        </el-table-column>
        <el-table-column prop="is_send" label="是否发货"> </el-table-column>
        <el-table-column prop="update_time" label="下单时间" width="300">
        </el-table-column>
        <el-table-column label="操作">
          <template slot-scope="scope">
            <el-button
              type="primary"
              size="mini"
              icon="el-icon-edit"
            ></el-button>
            <el-button
              type="danger"
              size="mini"
              icon="el-icon-star-off"
            ></el-button>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
  </div>
</template>

<script>
import { sights, orders } from '@/api/login.js'
export default {
  data() {
    return {
      keyword: '',
      tableData: [],
      pagesize: 5,
      pagenum: 1,
      total: 0,
    }
  },
  mounted() {
    this.getlist()
  },
  methods: {
    getlist() {
      orders().then((res) => {
        // console.log(res.data.data.goods)
        res.data.data.goods.forEach((item) => {
          var unixTimestamp = new Date(item.update_time * 1000)
          let commonTime = unixTimestamp.toLocaleString()
          item.update_time = commonTime
          this.tableData = res.data.data.goods
        })
      })
    },
  },
  computed: {},
  watch: {},
}
</script>

<style scoped lang="scss">
.box {
  padding: 20px;
  .box-card {
    margin: 20px 0px;
    input {
      .aa {
        text-align: center;
      }
    }
  }
}
.el-button {
  text-align: center;
}
</style>
